import Koa from 'koa';
import socket from 'koa-websocket';
import cors from 'koa2-cors';
import bodyParser from 'koa-bodyparser';
import login from './routers/Login';
import { playerSocket } from './routers/Socket'
import { createRoom, getRoomList, joinRoom } from './routers/Room';
const PORT = 83;
const server = socket(new Koa(),{});
server.ws.use(playerSocket);
server.use(bodyParser())
server.use(cors())

server.use(login.getAllUser);
server.use(login.getUserInfo);
server.use(login.userLogin);

server.use(createRoom);
server.use(getRoomList);
server.use(joinRoom);

server.listen(PORT,()=>{
    console.log('success')
})